/**
 *******************************************************************************
 * @FileName  : keyboard.h
 * @Author    : GaoQiu
 * @CreateDate: 2020-05-18
 * @Copyright : Copyright(C) GaoQiu
 *              All Rights Reserved.
 *******************************************************************************
 */
#ifndef KEY_BOARD_H_
#define KEY_BOARD_H_

#include "utils/defs_types.h"
#include "key_code.h"

/*! Maximum number of keys being pressed at the same time. */
#define KEY_MAX_NUM     8

/*! valid level. */
#define KEY_VALID_LEVEL  1

/*! key code. */
#define	CR_VOL_UP		0xf0
#define	CR_VOL_DN		0xf1
#define BTN_PAIR		0x01
#define BTN_UNPAIR		0x02

/*! key control block. */
typedef struct{
	uint8_t cnt;
	uint8_t keyCode[KEY_MAX_NUM];
}KbCb_t;

extern KbCb_t kbCb;

/**
 * @brief  : Keyboard initialization.
 * @param  : none.
 * @return : none.
 */
void KB_Init(void);

/**
 * @brief  : Keyboard scan.
 * @param  : none.
 * @return : TRUE if key changed otherwise FALSE.
 */
bool_t KB_Scan(void);

#endif /* KEY_H_ */
